package com.yonyou.pmclouds.basecom.util;

import javax.xml.bind.DatatypeConverter;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class SecurityUtil {
	public static String EncoderByMd5(String str) {

		try {
			MessageDigest md5 = MessageDigest.getInstance("MD5");
			String newstr = DatatypeConverter.printBase64Binary(md5.digest(str.getBytes("utf-8")));
			return newstr;
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return null;
	}
}
